How to build the Renderware Maya exporter:

General
------------------------
Mayaexp.dsw is a Microsoft Visual Studio workspace containing projects to
build the bsp, dff and spl exporters. Each project contains release and
debug targets for Maya 2.0, 2.5 and 3.0.

To build the projects you will need a RenderWare SDK and Maya SDK relevant to
the version of the exporter you wish to build. You should use the RenderWare
SDK that the exporter source was shipped with. The exporter project paths are
setup to look for the RenderWare libs and headers in their default locations
relative to the exporter source install directory. The paths to the Maya SDK
assume the default Maya installation directories:

c:\AW\Mayax.x

If you have installed Maya to a different drive or directory you will need
to update the project files as appropriate.


MDT
------------------------
The RenderWare Maya exporters make use of the Maya SDK MDt library. This
library is shipped in both binary and source forms in the Maya SDK. During
development we have encountered some problems with the MDt library and have
needed to make modifications to the library source. We link the release
exporter binaries against these modified version of the library. If you
wish to rebuild the exporters we recommend you make similar modifications
to the MDt library you link against.

You can find the source to the MDt library in

\AW\Mayax.x\devkit\games\MDtApi

This directory contains a Visual Studio project file that should allow you
to easily rebuild the library. Once rebuilt a release MDt library should be
copied from

\AW\Mayax.x\devkit\games

to

\AW\Mayax.x\lib

You may wish to rename the old MDt library before copying.


Maya 2.5 MDT Changes
------------------------
This version of the MDT library had an error that prevented MDt from
traversing node hierarchies correctly. This will cause exports from the
DFF exporter to incorrectly exclude some object from the selected hierarchy.
To fix this you need to modify MDtShape.cpp. Delete lines 7922 to 7945. In
their place insert the following code:

	// Determine the parents of the shape nodes.
	//
	for( int i = 0; i < local->shapeCount; i++ )
    {
        ShapeStruct *shape = &local->shapes[i];

		// Try to get the matrix for the shape. For testing.
		//
		float *matrix;
		DtShapeGetMatrix( i, &matrix );

		// Find the parent of the shape.
		//
		if( ! shape->transformNode.isNull() )
		{
            if (shape->parentDagPath)
            {
			    MObject parentNode = shape->parentDagPath->transform();

			    // If a parent exists, search the shape list for the parent shape.
			    // Else, set the parent to NULL.
			    //
			    if( ! parentNode.isNull() )
			    {
				    for( int j = 0; j < local->shapeCount; j++ )
				    {
					    if( parentNode == local->shapes[j].transformNode )
					    {
						    shape->firstParentStruct = &local->shapes[j];
						    break;
					    }
				    }
			    }
		    }
        }
    }

This problem is documented on the AW website in the API Knowledgebase
section ('DtShapeGetChildren doesn't work in Maya 2.5?').


Maya 2.5 & 3 MDT Changes
------------------------
The Maya 2.5 and 3.0 MDt libs contain a problem with prelighting values.
This can lead to random colors being assigned and low alpha values that
make prelit objects transparent. To correct these problems you need to modify
the processMesh() function in MDtShape.cpp.

Find the following piece of code in the function:

	vertColor[ hh ].r = 255 * colorArray[hh].r;
	vertColor[ hh ].g = 255 * colorArray[hh].g;
	vertColor[ hh ].b = 255 * colorArray[hh].b;
	vertColor[ hh ].a = 1;

and change it to:

	if (colorArray[hh].r > 1.0f)
	{
		vertColor[ hh ].r = 255;
	}
	else
	{
		vertColor[ hh ].r = 255 * colorArray[hh].r;
	}

	if (colorArray[hh].g > 1.0f)
	{
		vertColor[ hh ].g = 255;
	}
	else
	{
		vertColor[ hh ].g = 255 * colorArray[hh].g;
	}
	
	if (colorArray[hh].b > 1.0f)
	{
		vertColor[ hh ].b = 255;
	}
	else
	{
		vertColor[ hh ].b = 255 * colorArray[hh].b;
	}
	
	if (colorArray[hh].a > 1.0f)
	{
		vertColor[ hh ].a = 255;
	}
	else
	{
		vertColor[ hh ].a = 255 * colorArray[hh].a;
	}

There are other pieces of code in the same function that have similar
problems but these do not affect the RenderWare Maya exporter.
